<form id="formEdit" class="form-horizontal" role="form">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">操作</h4>
            </div>
            <div class="modal-body">
            	<!-- 以下为要修改的的内容 -->
				<input type="hidden" name="id" data-th-value="${model.id}">
                <div class="form-group">
                	<label for="txt_file" class="col-sm-2 control-label">照片</label>
                	<div class="col-sm-10">
	                     <input type="file" name="file"  class="file" id="text_file" placeholder="上传照片 ">
                	</div>
                </div>
                <div class="form-group">
                	<label class="col-sm-2 control-label" for="txt_stuNum">学号</label>
                	<div class=col-sm-9>
                    <input type="text" name="stuNum" data-th-value="${model.stuNum}" class="form-control" id="txt_stuNum" placeholder="学号">
                	</div>
                </div>
                <div class="form-group">
                	<label for="txt_name" class="col-sm-2 control-label">姓名</label>
                	<div class="col-sm-9">
	                    <input type="text" name="name" data-th-value="${model.name}" class="form-control" id="txt_name" placeholder="姓名">
                	</div>
                </div>
                <div class="form-group">
                	<label for="txt_sex" class="col-sm-2 control-label">性别</label>
                	<div class="col-sm-9">
	                    <select name="sex" data-th-value="${model.sex}" id="text_sex" class="form-control">
							<option value="男" data-th-selected="${model.sex=='男'}">男</option>                    
							<option value="女" data-th-selected="${model.sex=='女'}">女</option>                    
	                    </select>
                	</div>
                </div>
                <div class="form-group">
                	<label for="txt_idCard" class="col-sm-2 control-label">身份证号码</label>
                	<div class="col-sm-9">
	                    <input type="text" name="idCard" data-th-value="${model.idCard}" class="form-control" id="txt_idCard" placeholder="身份证号码">
                	</div>
                </div>
                <!-- <div class="form-group">
                	<label for="txt_pwd" class="col-sm-2 control-label">密码</label>
                	<div class="col-sm-9">
	                    <input type="password" name="pwd" data-th-value="${model.pwd}" class="form-control" id="txt_pwd" placeholder="密码">
                	</div>
                </div> -->
                <div class="form-group">
                	<label for="txt_job" class="col-sm-2 control-label">职务</label>
                	<div class="col-sm-9">
	                    <input type="text" name="job" data-th-value="${model.job}" class="form-control" id="txt_job" placeholder="职务">
                	</div>
                </div>
                <div class="form-group">
                	<label for="txt_phone" class="col-sm-2 control-label">电话</label>
                    <div class="col-sm-9">
	                    <input type="text" name="phone" data-th-value="${model.phone}" class="form-control" id="txt_phone" placeholder="电话">
                    </div>
                </div>
                <div class="form-group">
                	<label for="txt_address" class="col-sm-2 control-label">家庭地址</label>
                    <div class="col-sm-9">
	                    <input type="text" name="address" data-th-value="${model.address}" class="form-control" id="txt_address" placeholder="家庭地址">
                    </div>
                </div>
			    <div class="form-group">
                	<label for="txt_addressPhone" class="col-sm-2 control-label">家庭电话</label>
                    <div class="col-sm-9">
	                    <input type="text" name="addressPhone" data-th-value="${model.addressPhone}" class="form-control" id="txt_addressPhone" placeholder="家庭电话">
                    </div>
                </div>
                <div class="form-group">
                	<label for="txt_bjId" class="col-sm-2 control-label">班级</label>
                    <div class="col-sm-9">
	                    <select class="form-control" id="txt_bjId" name="tbClass.id">
	                    	 <option th:each="bj:${bjs}" th:value="${bj.id}" th:text="${bj.name}" data-th-selected="${model.tbClass!=null&&model.tbClass.id==bj.id}">我是默认值</option>
	                    </select>
                    </div>
                </div>
                <!-- 以上为要修改的内容 -->
            </div>
            <div class="modal-footer">
                <button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span>保存</button>
                <button type="button" class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span>关闭</button>
            </div>
        </div>
    </div>
</form>
<script type="text/javascript" th:inline="javascript">
    $(function () {
　　　　 	var options= {
			message: '验证不通过',
			feedbackIcons: {
                 valid: 'glyphicon glyphicon-ok',
                 invalid: 'glyphicon glyphicon-remove',
                 validating: 'glyphicon glyphicon-refresh'
             },
             fields: { 
             	
            	 stuNum: {
    				validators: {
    					notEmpty: {
    						message: '学号不能为空'
    					}
    				}
    			},
    			name: {
    				validators: {
    					notEmpty: {
    						message: '姓名内容不能为空'
    					}
    				}
    			},
    			address:{
					validators:{
						notEmpty:{
							message:'地址不能为空'
						}
					}
				},
				addressPhone:{
					validators:{
						notEmpty:{
							message:'家庭电话不能为空'
						}
					}
				}
             }
         };
        $('#formEdit').bootstrapValidator(options).on('success.form.bv', function(e) {
        	e.preventDefault();							   	//很重要没有它则会提交默认表单，不会做下面的ajax表单提交
            var fd = new FormData($("#formEdit")[0]);  
            $.ajax({  
              url: "save",  
              type: "POST",  
              data: fd,  
              processData: false,  // 不处理数据  
              contentType: false,   // 不设置内容类型
              success:function(data){
            	  if(data.success){
	            	  $('#myModal').modal("hide");
            	  }else{
            		  bootbox.alert(data.msg);
            	  }
              }
            });  
        });
    });
</script>